/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.awt.Color;
import javax.swing.JTable;
import javax.swing.table.*;


/**
 *
 * @author Home
 */
public class ColorTable extends JTable {

    private DefaultTableCellRenderer oddRenderer;
    private DefaultTableCellRenderer evenRenderer;

    public ColorTable()
    {

    }
    public ColorTable(TableModel tm) {
        super();
    }

    public ColorTable(Object[][] data, Object[] columns) {
        super(data, columns);
    }

    public ColorTable(int rows, int columns) {
        super(rows, columns);
    }

    @Override
    public TableCellRenderer getCellRenderer(int row, int colum) {
        TableCellRenderer cellRenderer;
        if (oddRenderer == null) {
            oddRenderer = new DefaultTableCellRenderer();
            oddRenderer.setBackground(new Color(181, 230, 29));
        }
        if (evenRenderer == null) {
            evenRenderer = new DefaultTableCellRenderer();
            //evenRenderer.setBackground(new Color(181, 230, 29));
        }

        cellRenderer = ((row % 2) == 0) ? oddRenderer : evenRenderer;
        return cellRenderer;
    }
}